GH-4205 Optimized the getClassOrNull method in ToolCallingAutoConfiguration
#4257
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The original intent of the
ToolCallingAutoConfiguration#getClassOrNullmethod is to attempt loading a specified class, returningnullif the class cannot be found. However, the current implementation prints the full stack trace when aClassNotFoundExceptionis thrown, which may mislead users into thinking there is a real problem (while in fact, this is an expected and normal behavior). This PR improves the exception handling in the method, so that when aClassNotFoundExceptionoccurs, only the class name is logged instead of the entire stack trace, thereby avoiding confusion and improving log clarity.Fixes #4205
Fixes #4249